#include "../../include/CrossFire.h"
#pragma comment(lib, "../../lib/CrossFire.lib")

void main()
{
	cfe::ICF_DeviceEngine* eng = cfe::getDeviceEngine(GetModuleHandle(0));
	cfe::ICF_Settings* settings = eng->getSettingsObject();
	settings->loadFromCfg("Config.cfg");
	
	cfe::ICF_Timer* timer = eng->getTimerObject();
	cfe::ICF_Log* log = eng->getLogObject();
	cfe::ICF_Input* input = eng->getInput();

	cfe::ICF_DrawRenderer* render = eng->getDrawRenderer();
	cfe::ICF_Window* window = eng->getWindowObject();
	render->Initialize(window->GetHandle());
	input->Initialize(window->GetHandle());

	cfe::ICF_SceneManager* smg = eng->getSceneManager();

	cfe::ICF_CameraNode* cam = smg->addVectorsCamera();
	smg->setCurrentCamera(cam);

	LPWSTR files[] =   {
		L"sky\\Left.jpg",
		L"sky\\Right.jpg",
		L"sky\\Top.jpg",
		L"sky\\Bottom.jpg",
		L"sky\\Front.jpg",
		L"sky\\Back.jpg",
	};
	cfe::ICF_SkyBoxNode* skybox = smg->addSkyBox(files, 10000);
	
	while(!window->IsDestroy())
	{
		input->Update();
		if(input->IsKeyDown(DIK_ESCAPE)) 
			break;
		render->Begin();

		smg->RenderScene();

		render->End();
	}
	smg->Destroy();

	eng->retain();
};